package upload;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Cilent {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost",10001);
        InputStream is = new FileInputStream("/Users/edy/Desktop/file/1.txt");
        OutputStream os = socket.getOutputStream();
        byte[] bytes = new byte[1024];
        int len;
        while ((len = is.read(bytes)) > 0) {
            os.write(bytes,0,len);
        }
        socket.shutdownOutput(); //告诉server写完了
        socket.close();

    }
}
